import threading
import time
import numba
class FastImport():
    def __init__(self,*args):
        self.resultlen:int=len(args)
        self.result:list = [0]*self.resultlen
        self.Lock=threading.Lock()
        self.signal:int=0
        for i in range(len(args)):
            a=threading.Thread(target=self.importmoudle,args=(args[i],i))
            a.start()
    def importmoudle(self,module,i):
        result=__import__(module)
        with self.Lock:
            self.result[i]=result
            self.signal=self.signal+1
    def get(self):
        while True:
            if self.resultlen==self.signal:
                break
            else:
                time.sleep(0.01)#fuck gil
                continue
        return self.result
if __name__ == "__main__":
    a=FastImport("numpy","torch")
    (numpy,torch)=a.get()
